<%@ Page Language="C#" MasterPageFile="~/Main.master" AutoEventWireup="true" CodeFile="OldPredictions.aspx.cs"
    Inherits="OldPredictions" Title="The Forecast Exchange - Old predictions" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <h1>
        Old predictions / results</h1>
    <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/ForecastExchange.mdb"
        SelectCommand="SELECT [ID], [Ticker], [Short_description], [Has_succeeded], [End_date], [Last_value], [Last_change] FROM [Prediction] WHERE ([Is_closed] = ?) ORDER BY [End_date] DESC">
        <SelectParameters>
            <asp:Parameter DefaultValue="true" Name="Is_closed" Type="Boolean" />
        </SelectParameters>
    </asp:AccessDataSource>
    <asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False"
        ForeColor="#333333" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px"
        CellPadding="2" GridLines="Vertical" DataKeyNames="ID" DataSourceID="AccessDataSource1" 
        Width="100%">
        <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
        <RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
        <Columns>
            <asp:TemplateField HeaderText="Ticker" SortExpression="Ticker" ItemStyle-Width="70px">
                <ItemTemplate>
                    <asp:Image ID="Image1" runat="server" ImageUrl="~/images/silk/sport_8ball.png" /> 
                    <a href="Prediction.aspx?id=<%# Eval("ID") %>">
                        <%# Eval("Ticker")%>
                    </a>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Prediction" SortExpression="Short_description">
                <ItemTemplate>
                    <a href="Prediction.aspx?id=<%# Eval("ID") %>">
                        <%# Eval("Short_description")%>
                    </a>
                </ItemTemplate>
            </asp:TemplateField>
        
                <asp:TemplateField HeaderText="End date" SortExpression="End_date">
            <ItemStyle HorizontalAlign="Center" />
            <ItemTemplate>
                <%# ((DateTime) Eval("End_date")).ToShortDateString() %>
            </ItemTemplate>
        </asp:TemplateField>   
        
            <asp:TemplateField HeaderText="Result" ItemStyle-HorizontalAlign="Center" SortExpression="Has_succeeded">
                <ItemTemplate>
                    <%# 
                        ((bool)Eval("Has_succeeded") ? "<span style=\"color:green;\">Succeeded</span>" : "<span style=\"color:red;\">Failed</span>")
                    %>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <EditRowStyle BackColor="#2461BF" />
        <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
        <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
        <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
        <AlternatingRowStyle BackColor="#F7F7F7" />
    </asp:GridView>
</asp:Content>
